<template>

<div>
  <el-button type="success" @click="Startapproval()"
             v-hasPermi="['audit:start:button']">
        开始审批
  </el-button>
<!--  <el-button type="success" @click="getUserTaskList()">-->
<!--    查看待办事项-->
<!--  </el-button>-->
  <template>
    <el-table
      :data="detailList"
      style="width: 100%">
      <el-table-column
        prop="createdDate"
        label="任务创建日期"
        width="180">
      </el-table-column>
      <el-table-column
        prop="id"
        label="任务id"
        width="180">
      </el-table-column>
      <el-table-column
        prop="name"
        label="任务名称">
      </el-table-column>
      <el-table-column>
        <template slot-scope="scop">
          <el-button  type="success" @click="getBusinessInfo(scop.row)">
            查看详情
          </el-button>
        </template>
      </el-table-column>
      <el-table-column>
        <template slot-scope="scop">
          <el-button  type="success" @click="orderrefund(scop.row)">
            退款审核通过
          </el-button>
        </template>
      </el-table-column>
      <el-table-column>
        <template slot-scope="scop">
          <el-button  type="success" @click="adminexaminetrue(scop.row)">
            审核通过
          </el-button>
        </template>
      </el-table-column>
      <el-table-column>
        <template slot-scope="scop">
          <el-button  type="success" @click="adminexaminetrue(scop.row)">
            审核不通过
          </el-button>
        </template>
      </el-table-column>

      <el-table-column>
        <template slot-scope="scop">
          <el-button  type="success" @click="financeexamine(scop.row)">
            财务审核通过
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </template>

  <el-dialog
    title="任务详情"
    :visible.sync="dialogVisible"
    width="30%">
    <span slot="footer" class="dialog-footer">

      <el-form label-width="80px" :model="detailListseleid">
  <el-form-item label="商户名称">
    <el-input v-model="detailListseleid.businessName"></el-input>
  </el-form-item>
  <el-form-item label="商户身份证">
    <el-input v-model="detailListseleid.businessIdcard"></el-input>
  </el-form-item>
  <el-form-item label="商户电话">
    <el-input v-model="detailListseleid.businessPhone"></el-input>
  </el-form-item>
        <el-form-item label="商户银行卡">
    <el-input v-model="detailListseleid.businessBankcard"></el-input>
  </el-form-item>
</el-form>
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  </span>
  </el-dialog>
</div>
</template>

<script>
import {listBusiness,merchantreview,getUserTaskList,getBusinessInfo,adminexamine,financeexamine,adminrantreview,cuserantreview}from "@/api/activiti/activiti";
import { findmerchantId, delBusiness, addBusiness, updateBusiness , addBusinessVerify} from "@/api/business/business";
export default {
  name: 'index',
  data(){
    return{
      detailList:[],
      dialogVisible:false,
      detailListseleid:{}
    }
  },
  methods:{
    orderrefund(row){
      const taskId= row.id;
      const  success=true;
      adminrantreview(taskId,success).then(res=>{
          this.$message.success("审核成功")
      })
    },
    Startapproval(){
      merchantreview().then(res=>{
      alert("流程开启成功")
      })
    },
    getUserTaskList(){
      getUserTaskList().then(res=>{
        console.log(res)
        this.detailList = res;
      })
    },
    getBusinessInfo(row){
        var  taskId=row.id;
      getBusinessInfo(taskId).then(res=>{
       if(res){
         console.log(res)
         this.dialogVisible=true;
         // const merchantId= res.merchantId;
         const merchantId=1;
         findmerchantId(merchantId).then(res=>{
           console.log(res)
            this.detailListseleid = res;
         })
       }
      })
    },
    adminexaminetrue(row){
      debugger
      const taskId= row.id;
      const  success=true;
      adminexamine(taskId,success).then(res=>{
        if(res){
          alert("审核成功")
        }
      })
    },
    financeexamine(row){

      const taskId= row.id;
      const  success=true;
      financeexamine(taskId,success).then(res=>{
      if(res){
        alert("审核成功")
      }
    })
    }
  },
  mounted() {
    this.getUserTaskList()

  }
}
</script>

<style scoped>

</style>
